package com.jiezuo.auth.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jiezuo.auth.entity.DepartUser;
import com.jiezuo.auth.service.DepartUserService;
import com.jiezuo.common.util.ResultUtil;
import com.jiezuo.common.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 庞留杰
 * @Date: 2021-06-02 9:46
 * @Description: *
 */
@Slf4j
@Transactional
@RequestMapping("/departUser")
@RestController
//部门用户信息", tags = {"部门用户信息接口"})
public class DepartUserController {
    @Autowired
    private DepartUserService service;

    @GetMapping("/findList")
    public Result<List<DepartUser>> findList(@ModelAttribute DepartUser departUser) {
        QueryWrapper<DepartUser> queryWrapper = new QueryWrapper<>();
        if (departUser.getDepartIdList() != null && departUser.getDepartIdList().size() > 0) {
            queryWrapper.in("depart_id", departUser.getDepartIdList());
        }
        //queryWrapper.eq("is_delete", "0");
        List<DepartUser> list = service.list(queryWrapper);
        return new ResultUtil<List<DepartUser>>().setData(list);
    }

}
